<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="UTF-8">
<title>皇室蛋糕</title>
<link rel="shortcut icon" type="image/x-icon" href="resource/bifavi.ico" rel="external nofollow" /> 
<link rel="stylesheet" type="text/css" href="res/static/css/main.css">
<link rel="stylesheet" type="text/css" href="res/layui/css/layui.css">
<script type="text/javascript" src="res/layui/layui.js"></script>
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">

</head>
<body>

	<div class="site-nav-bg">
		<div class="site-nav w1200">
			<p class="sn-back-home">
				<i class="layui-icon layui-icon-home"></i> <a href="index.jsp">首页</a>
			</p>
			<div class="sn-quick-menu">
				<div class="login">
					<c:if test="${CURR_COM == null }">
						<a href="goConsumerLogin">登录</a>
					</c:if>
					<c:if test="${CURR_COM != null }">
						<a href="gopersoninfo"><c:out value="${CURR_COM}" /></a>  &nbsp; &nbsp; &nbsp;
						<a href="zhuxiao">注销</a>
					</c:if>
				</div>
				<div class="sp-cart">
					<a href="goshopcar">购物车</a><span><c:if
							test="${CURR_NUM == null }"></c:if> <c:if
							test="${CURR_NUM != null }">
							<c:out value="${CURR_NUM}" />
						</c:if></span>
				</div>
			</div>
		</div>
	</div>



	<div class="header">
		<div class="headerLayout w1200">
			<div class="headerCon">
				<h1 class="mallLogo">
					<a href="index.jsp" title="皇室蛋糕"> <img
						src="images/img/logo1.png">
					</a>
				</h1>
				<div class="mallSearch">
					<form action="goSearchJsp" class="layui-form" novalidate>
						<input type="text" name="title" required lay-verify="required"
							autocomplete="off" class="layui-input" placeholder="请输入需要的商品">
						<button class="layui-btn" lay-submit lay-filter="formDemo">
							<i class="layui-icon layui-icon-search"></i>
						</button>
						<input type="hidden" name="" value="">
					</form>
				</div>
			</div>
		</div>
	</div>


	<div class="content content-nav-base shopcart-content">
		<div class="main-nav">
			<div class="inner-cont0">
				<div class="inner-cont1 w1200">
					<div class="inner-cont2">
						<a href="commodity.html" class="active">所有商品</a> <a href="gotusi">吐司和礼品</a>
						<a href="information.html">烘焙故事</a> <a href="aboutUs">关于我们</a>
					</div>
				</div>
			</div>
		</div>
		<div class="banner-bg w1200">
			<h3>夏季清仓</h3>
			<p>宝宝被子、宝宝衣服3折起</p>
		</div>
		<div class="cart w1200">
			<div class="cart-table-th">
				<div class="th th-chk">
					<div class="select-all">
						<div class="cart-checkbox">
							<input class="check-all check" id="allCheckked" type="checkbox"
								value="-1">
						</div>
						<label>&nbsp;&nbsp;全选</label>
					</div>
				</div>
				<div class="th th-item">
					<div class="th-inner">商品</div>
				</div>
				<div class="th th-price">
					<div class="th-inner">单价</div>
				</div>
				<div class="th th-amount">
					<div class="th-inner">数量</div>
				</div>
				<div class="th th-sum">
					<div class="th-inner">小计</div>
				</div>
				<div class="th th-op">
					<div class="th-inner">操作</div>
				</div>
			</div>
			<div class="OrderList">
				<div class="order-content" id="list-cont">
					<!-- 模版导入数据 -->
					<script type="text/html" id="demo">
        {{# layui.each(d.infoList,function(index,item){}}
          <ul class="item-content layui-clear">
            <li class="th th-chk">
              <div class="select-all">
                <div class="cart-checkbox">
                  <input class="CheckBoxShop check" id="" type="checkbox" num="all" name="select-all" value="{{item.scid}}">
                </div>
              </div>
            </li>
            <li class="th th-item">
              <div class="item-cont">
                <a href="javascript:;"><img src="{{item.img}}" alt=""></a>
                <div class="text">
                  <div class="title">{{item.title}}</div>
					 <input type="hidden" value="{{item.name}}">
                  <p><span>粉色</span>  <span>130</span>cm</p>
                </div>
              </div>
            </li>
            <li class="th th-price">
              <span class="th-su">{{item.price}}</span>
            </li>
            <li class="th th-amount">
              <div class="box-btn layui-clear">
                <div class="less layui-btn">-</div>
                <input class="Quantity-input" type="" name="" value="{{item.num}}" disabled="disabled">
                <div class="add layui-btn">+</div>
              </div>
            </li>
            <li class="th th-sum">
              <span class="sum">{{item.price}}</span>
            </li>
            <li class="th th-op">
              <span class="dele-btn">删除</span>
            </li>
          </ul>
        {{# });}}
      </script>
				</div>
			</div>

   
<!-- <img alt="" src="/goodsimage/"> -->
      <div class="FloatBarHolder layui-clear">
        <div class="th th-chk">
          <div class="select-all">
            <div class="cart-checkbox">
              <input class="check-all check" id="" name="select-all" type="checkbox"  value="-1">
            </div>
            <label>&nbsp;&nbsp;已选<span class="Selected-pieces">0</span>件</label>
          </div>
        </div>
        <div class="th batch-deletion">
          <span class="batch-dele-btn">批量删除</span>
        </div>
        <div class="th Settlement">
          <!-- <a href="BookController" id="jiesuanBtn"></a> --><button id="jiesuanBtn" class="layui-btn">结算</button>
        </div>
        <div class="th total">
          <p>应付：<span class="pieces-total">0</span></p>
        </div>
      </div>
    </div>
  </div>
				<div id="liutibtn">  <button class="layui-btn layui-btn-fluid">流体按钮</button></div>
	  <!-- 底部 -->
  <div class="footer">
    <div class="ng-promise-box">
      <div class="ng-promise w1200">
        <p class="text">
          <a class="icon1" href="javascript:;">7天无理由退换货</a>
          <a class="icon2" href="javascript:;">满99元全场免邮</a>
          <a class="icon3" style="margin-right: 0" href="javascript:;">100%品质保证</a>
        </p>
      </div>
    </div>
    <div class="mod_help w1200">                                     
      <p>
        <a href="aboutUs">关于我们</a>
        <span>|</span>
        <a href="helpCenter">帮助中心</a>
        <span>|</span>
        <a href="afterService">售后服务</a>
        <span>|</span>
        <a href="javascript:;">客服资讯</a>
        <span>|</span>
        <a href="javascript:;">关于货源</a>
      </p>
      <p class="coty">皇室蛋糕版权所有 &copy; 2018-2020</p>
    </div>
  </div>
	<script type="text/javascript">
			//你存放新模块的目录，注意，不是layui的模块目录
		layui.config({base : 'res/static/js/util/' }).use(
						[ 'mm', 'jquery', 'element', 'car' ],
						function() {
							var mm = layui.mm, $ = layui.$, element = layui.element, car = layui.car;

							// 模版导入数据
							var html = demo.innerHTML, listCont = document
									.getElementById('list-cont');
							mm.request({
								url : 'goshopcart',
								success : function(res) {
									listCont.innerHTML = mm.renderHtml(html,
											res)
									element.render();
									car.init()
								},
								error : function(res) {
									console.log(res);
								}
							})

						});
			$("#jiesuanBtn").click(function(){
			//$("#liutibtn").click(function(){
				console.log($("input:checked").val())
			console.log($("input:checked"));
				//var datas=[];
				//var temp;
				var demo={datas:[]};
				$("input:checked").each(function(){
					var	cid=$(this).parent().parent().parent().parent().children().eq(0).find("input").val();
					var name=$(this).parent().parent().parent().parent().children().eq(1).find("input").val();
					var	price=$(this).parent().parent().parent().parent().children().eq(2).text();
					var	num=$(this).parent().parent().parent().parent().children().eq(3).find("input").val();
					console.log(name);
					console.log(cid);// 获取到 购物车ID
					console.log(price);			  // 获取到单价
					console.log(num);// 获取到num 数量
					
					console.log("---------------------------1111-----------------------------------");
					if(cid>0){
					var temp={
							scid:cid,
							scname:name,
							scPrice:price,
							scnum:num
					};
					demo.datas.push(temp); 
					}
				})
				   var jsonString = JSON.stringify(demo);
			
				console.log("+++++++++++++++++++++++++++++222+++++++++++++++++++++++++++++++++++++++");
				console.log(jsonString);  
				$.ajax({
					   type: "POST",
					   url: "BookController",
					   //url: "addshopcartdemo",
					   data: "data="+jsonString,
					   dataType:'JSON',
					   success: function(msg){
						   console.log( "msg DEMO: " + msg );
						   var jsonOrder={
							   info:msg
						   }
						/*  alert( "msg DEMO: " + msg );  */
						 console.log("llllllllllll")
						/* alert("11111111111") */
						 window.location.href="BookOrder"; 
						   
					   }
					});
				
			})
			
	</script>


</body>
</html>